1678-goal-parser-interpretation.py
problem: ---
problem:

You own a Goal Parser that can interpret a string command. The command consists of an alphabet of "G", "()" and/or "(al)" 
in some order. The Goal Parser will interpret "G" as the string "G", "()" as the string "o", and "(al)" as the string "al". 
The interpreted strings are then concatenated in the original order.
Given the string command, return the Goal Parser's interpretation of command.

Example 1:
Input: command = "G()(al)"
Output: "Goal"
Explanation: The Goal Parser interprets the command as follows:
G -> G
() -> o
(al) -> al
The final concatenated result is "Goal".

Example 2:
Input: command = "G()()()()(al)"
Output: "Gooooal"

Example 3:
Input: command = "(al)G(al)()()G"
Output: "alGalooG"
 
Constraints:
1 <= command.length <= 100
---

-----------------------------------------------------------------------
bug_fixes: ---
bug_fixes:
Add `is_o = False` to line 9.
Replace `else if` with `elif` on line 10.
Replace `res.join("")` with "".join(res) on line 16.
---

-----------------------------------------------------------------------
bug_desc: ---
bug_desc:
On line 9, after finding a ')', is_o must be set to False, ottherwise incorrect behavior will occur. Without setting it to False, it might never go back fom True to False, which will result in incorrect behavior. Therefore, once ')' is found, is_o must be set to False.
On line 10, incorrect syntax is used for the else-if block. In Python, else-if is spelled elif.
On line 16, the join() method is used incorrectly, as it is a string method. To fix the bug, reverse the arguments like so: "".join(res).
---

-----------------------------------------------------------------------
line_no: ---
line_no:
9
---

-----------------------------------------------------------------------
buggy_code: ---
buggy_code:
1. class Solution:
2.     def interpret(self, command: str) -> str:
3.         res = []
4.         is_o = False
5.         for i in range(len(command)):
6.             if command[i] == ")":
7.                 if is_o:
8.                     res.append('o')
9.                 
10.             else if command[i] == "(":
11.                 is_o = True
12.             else:
13.                 res.append(command[i])
14.                 is_o = False
15.                 
16.         return res.join("")
---

-----------------------------------------------------------------------
correct_code: ---
correct_code:
1. class Solution:
2.     def interpret(self, command: str) -> str:
3.         res = []
4.         is_o = False
5.         for i in range(len(command)):
6.             if command[i] == ")":
7.                 if is_o:
8.                     res.append('o')
9.                 is_o = False
10.             elif command[i] == "(":
11.                 is_o = True
12.             else:
13.                 res.append(command[i])
14.                 is_o = False
15.                 
16.         return "".join(res)
---

-----------------------------------------------------------------------
